﻿Imports System.Data
Imports System.Data.OleDb
Imports geraLaudosQuimicaLegal.conexao
Imports System.Text
Public Class usuariosDAO
    Private DS As New DataSet

    Public Function GETUSUARIOS(ByVal idTipoUsuario As Integer) As DataTable
        Dim tabela As New DataTable
        Dim da As New OleDbDataAdapter
        Dim objConn As New conexao
        Dim sql As New StringBuilder
        Try
            sql.Append("SELECT *FROM USUARIOS WHERE STATUS=TRUE AND ID_TIPO_USUARIO=@ID_TIPO_USUARIO ORDER BY NOME")
            da = New OleDbDataAdapter(sql.ToString, objConn.abreConexao)
            da.SelectCommand.Parameters.AddWithValue("@ID_TIPO_USUARIO", idTipoUsuario)
            da.Fill(DS, "registros")
            tabela = DS.Tables("registros")
            Return tabela
        Catch ex As Exception
            generica.gravaErro(ex)
            Throw ex
        Finally
            objConn.fechaConexao()
        End Try
    End Function
End Class
